package com.wcgksoft.entity.system;

import com.fasterxml.jackson.annotation.JsonFormat;
import com.wcgksoft.entity.ConstructionTeam.ConstructionTeam;
import com.wcgksoft.entity.goods.AddServiceDetails;
import com.wcgksoft.entity.order.OrderDetails;
import org.hibernate.annotations.Cascade;
import org.hibernate.annotations.Fetch;
import org.hibernate.annotations.FetchMode;

import javax.persistence.*;
import java.io.Serializable;
import java.util.Date;
import java.util.Set;

/**
 * 用户信息表
 * @author Dell
 *
 */
@Entity
@Table(name="Sys_User")
public class SysUser implements Serializable{

	/**
	 * 
	 */
	private static final long serialVersionUID = -1636997257344875812L;


	/**
	 * id
	 */
	@Id
	@Basic(optional = false)
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	@Column(name = "id", nullable = false)
	private Integer id;

	/**
	 * 手机号 账号
	 */
	@Column(name = "phone",length=20)
	private String phone;
	
	/**
	 * 密码
	 */
	@Column(name = "pass_word",length=100)
	private String passWord;
	
	/**
	 * 负责人姓名
	 */
	@Column(name = "name",length=20)
	private String name;
	
	/**
	 * 身份证号/社会信用代码
	 */
	@Column(name = "id_card",length=20)
	private String idCard;
	
	/**
	 * 性别
	 */
	@Column(name = "sex",length=2)
	private String sex;

	/**
	 * 0个人/1企业
	 */
	@Column(name = "isPerson")
	private Integer isPerson;

	/**
	 * 联系方式
	 */
	@Column(name = "mobile")
	private String mobile;

	/**
	 *开户行名称
	 */
	@Column(name = "bankName")
	private String bankName;

	/**
	 * 银行卡号
	 */
	@Column(name = "bankNum",length = 19)
	private String bankNum;

	/**
	 * 销售员id
	 */
	@Column(name = "saleMan_id")
	private Integer saleMan_id;

	/**
	 * 代理商id
	 */
	@Column(name = "agent_id")
	private Integer agent_id;

	
	/**
	 * 固定电话
	 */
	@Column(name = "tele_phone",length=20)
	private String telePhone;
	
	/**
	 * 邮箱
	 */
	@Column(name = "email",length=30)
	private String email;


	/**
	 *角色id
	 */
	@Column(name = "jurisid")
	private Integer jurisid;

	/**
	 * 公司名称
	 */
	@Column(name = "company_name",length=50)
	private String companyName;
	
	/**
	 * 注册资金
	 */
	@Column(name = "funds")
	private Integer funds;
		/**
	 * z状态
	 */
	@Column(name = "status")
	private Integer status;

	/**
	 * 企业地址
	 */
	@Column(name = "address")
	private String address;
	
	/**
	 *  注册日期
	 */
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	@Column(name = "create_date")
	private Date createDate;


	/**
	 * 激活状态 0 激活  1 审核中 2 未通过
	 */
	@Column(name = "isCross")
	private Integer isCross;


	/**
	 *  到期日期
	 */
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	@Column(name = "endTime")
	private Date endTime;
	
	/**
	 *  出生日期
	 */
	@JsonFormat(pattern="yyyy-MM-dd HH:mm:ss",timezone = "GMT+8")
	@Column(name = "birth_date")
	private Date birthDate;

	/**
	 * 施工队伍ID
	 */
	@Column(name = "team_id")
	private Integer team_id;

	/**
	 * 施工账号项目ID
	 */
	@Column(name = "project_id")
	private Integer projectid;

	/**
	 * 施工账号片区ID
	 */
	@Column(name = "area_id")
	private Integer areaid;

	/**
	 * 施工账号绿地ID
	 */
	@Column(name = "greenland_id")
	private String greenlandid;

	/**
	 * 企业id
	 */
	@OneToOne(fetch = FetchType.EAGER, optional = true)
	@JoinColumn(name = "enterprise_id", nullable = true)
	@Cascade({org.hibernate.annotations.CascadeType.REFRESH})
	private Enterprise enterprise;

	/**
	 * 增值服务详细表
	 */

	//@JsonManagedReference
	@OneToMany(cascade = CascadeType.ALL, fetch = FetchType.LAZY, mappedBy = "sysUser")
	private Set<AddServiceDetails> addServiceDetails;


	/**
	 *政府id
	 */
	@Column(name = "gov_id")
	private Integer gov_id;
//	/**
//	 * 省份
//	 */
//	@OneToOne(fetch = FetchType.EAGER,optional=true)
//	@JoinColumn(name = "province_id",nullable=true)
//	@Cascade({org.hibernate.annotations.CascadeType.REFRESH})
//	private Province province;


/*
	*/
	/**
	 * 角色
	 */

	@OneToOne(fetch = FetchType.EAGER,optional=true)
	@JoinColumn(name = "role_id",nullable=true)
	@Cascade({org.hibernate.annotations.CascadeType.REFRESH})
	private SysRole sysRole;

	/**
	 * 施工账号中施工队伍
	 */

	@OneToOne(fetch = FetchType.EAGER,optional=true)
	@JoinColumn(name = "teams_id",nullable=true)
	@Cascade({org.hibernate.annotations.CascadeType.REFRESH})
	private ConstructionTeam constructionTeam;

	public Integer getAgent_id() {
		return agent_id;
	}

	public void setAgent_id(Integer agent_id) {
		this.agent_id = agent_id;
	}

	public Date getEndTime() {
		return endTime;
	}

	public void setEndTime(Date endTime) {
		this.endTime = endTime;
	}

	/**
	 * 场景类型
	 */
	@Column(name = "placeType")
	private String placeType;

	/**
	 * 健康分数
	 */
	@Column(name = "healthScore")
	private String healthScore;

	/**
	 * 备注
	 */
	@Column(name = "remker")
	private String remker;

	/**
	 * 是否驳回 1 显示 2不显示
	 */
	@Column(name = "isView")
	private Integer isView;

	/**
	 * 关联项目id
	 * */
	@Column(name="proId")
	private Integer proId;

	public Integer getIsCross() {
		return isCross;
	}

	public void setIsCross(Integer isCross) {
		this.isCross = isCross;
	}

	public Integer getIsView() {
		return isView;
	}

	public void setIsView(Integer isView) {
		this.isView = isView;
	}

	public String getPlaceType() {
		return placeType;
	}

	public void setPlaceType(String placeType) {
		this.placeType = placeType;
	}

	public String getHealthScore() {
		return healthScore;
	}

	public void setHealthScore(String healthScore) {
		this.healthScore = healthScore;
	}

	public Integer getIsPerson() {
		return isPerson;
	}

	public void setIsPerson(Integer isPerson) {
		this.isPerson = isPerson;
	}

	public String getMobile() {
		return mobile;
	}

	public void setMobile(String mobile) {
		this.mobile = mobile;
	}

	public String getBankName() {
		return bankName;
	}

	public void setBankName(String bankName) {
		this.bankName = bankName;
	}

	public String getBankNum() {
		return bankNum;
	}

	public void setBankNum(String bankNum) {
		this.bankNum = bankNum;
	}

	public Integer getSaleMan_id() {
		return saleMan_id;
	}

	public void setSaleMan_id(Integer saleMan_id) {
		this.saleMan_id = saleMan_id;
	}

	public Integer getProId() {
		return proId;
	}

	public void setProId(Integer proId) {
		this.proId = proId;
	}

	public Set<AddServiceDetails> getAddServiceDetails() {
		return addServiceDetails;
	}

	public void setAddServiceDetails(Set<AddServiceDetails> addServiceDetails) {
		this.addServiceDetails = addServiceDetails;
	}

	/*可见片区或项目*/
	@ManyToMany(cascade = CascadeType.REMOVE, fetch = FetchType.EAGER)
	@Fetch(FetchMode.SUBSELECT)
	@JoinTable(
					name = "pro_user",//中间表名
					joinColumns = {@JoinColumn(name = "user")},//当前对象id在中间表的列名
					inverseJoinColumns = {@JoinColumn(name = "pro")}//关联的另一个表在中间表的列名
	)



	private Set<EnterpriseProject> enterpriseProjects;

	public Integer getTeam_id() {
		return team_id;
	}

	public void setTeam_id(Integer team_id) {
		this.team_id = team_id;
	}

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public String getPhone() {
        return phone;
    }

    public void setPhone(String phone) {
        this.phone = phone;
    }

    public String getPassWord() {
        return passWord;
    }

    public void setPassWord(String passWord) {
        this.passWord = passWord;
    }

    public String getName() {
        return name;
    }

    public void setName(String name) {
        this.name = name;
    }

    public String getIdCard() {
        return idCard;
    }

    public void setIdCard(String idCard) {
        this.idCard = idCard;
    }

    public String getSex() {
        return sex;
    }

    public void setSex(String sex) {
        this.sex = sex;
    }

    public String getTelePhone() {
        return telePhone;
    }

    public void setTelePhone(String telePhone) {
        this.telePhone = telePhone;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getJurisid() {
        return jurisid;
    }

    public void setJurisid(Integer jurisid) {
        this.jurisid = jurisid;
    }

    public String getCompanyName() {
        return companyName;
    }

    public void setCompanyName(String companyName) {
        this.companyName = companyName;
    }

    public Integer getFunds() {
        return funds;
    }

    public void setFunds(Integer funds) {
        this.funds = funds;
    }

    public Integer getStatus() {
        return status;
    }

    public void setStatus(Integer status) {
        this.status = status;
    }

    public String getAddress() {
        return address;
    }

    public void setAddress(String address) {
        this.address = address;
    }

    public Date getCreateDate() {
        return createDate;
    }

    public void setCreateDate(Date createDate) {
        this.createDate = createDate;
    }

    public Date getBirthDate() {
        return birthDate;
    }

    public void setBirthDate(Date birthDate) {
        this.birthDate = birthDate;
    }

    public Enterprise getEnterprise() {
        return enterprise;
    }

    public void setEnterprise(Enterprise enterprise) {
        this.enterprise = enterprise;
    }

    public SysRole getSysRole() {
        return sysRole;
    }

    public void setSysRole(SysRole sysRole) {
        this.sysRole = sysRole;
    }

    public String getRemker() {
        return remker;
    }

    public void setRemker(String remker) {
        this.remker = remker;
    }

    public Set<EnterpriseProject> getEnterpriseProjects() {
        return enterpriseProjects;
    }

    public void setEnterpriseProjects(Set<EnterpriseProject> enterpriseProjects) {
        this.enterpriseProjects = enterpriseProjects;
    }

	public ConstructionTeam getConstructionTeam() {
		return constructionTeam;
	}

	public void setConstructionTeam(ConstructionTeam constructionTeam) {
		this.constructionTeam = constructionTeam;
	}

	public Integer getProjectid() {
		return projectid;
	}

	public void setProjectid(Integer projectid) {
		this.projectid = projectid;
	}

	public Integer getAreaid() {
		return areaid;
	}

	public void setAreaid(Integer areaid) {
		this.areaid = areaid;
	}

	public String getGreenlandid() {
		return greenlandid;
	}

	public void setGreenlandid(String greenlandid) {
		this.greenlandid = greenlandid;
	}

	public Integer getGov_id() {
		return gov_id;
	}

	public void setGov_id(Integer gov_id) {
		this.gov_id = gov_id;
	}
}
